home *** CD-ROM | disk | FTP | other *** search
/ HPAVC / HPAVC CD-ROM.iso / SS0288.ZIP / SS0288_5.TXT < prev    next >
Text File  |  1992-06-01  |  30KB  |  813 lines

  1. A0H OR A1H LEDATA--LOGICAL ENUMERATED DATA RECORD
  2. =================================================
  3.  
  4. Description
  5. -----------
  6.  
  7. This record provides contiguous binary data--executable code or
  8. program data--that is part of a program segment. The data is
  9. eventually copied into the program's executable binary image by the
  10. linker.
  11.  
  12. The data bytes may be subject to relocation or fixing up as determined
  13. by the presence of a subsequent FIXUPP record, but otherwise they
  14. require no expansion when mapped to memory at run time.
  15.  
  16. History
  17. -------
  18.  
  19. Record type A1H is new for LINK386; it has an Enumerated Data Offset
  20. field of 32 bits rather than 16 bits.
  21.  
  22. Record Format
  23. -------------
  24.    
  25.    1      2       1 or 2   2 or 4      <from Record Length>  1
  26.    A0     Record  Segment  Enumerated  Data                  Checksum
  27.    or A1  Length  Index    Data        Bytes                 
  28.                            Offset
  29.  
  30. Segment Index Field
  31. -------------------
  32.  
  33. The Segment Index field must be nonzero and is the index of a
  34. previously defined SEGDEF record. This is the segment into which the
  35. data in this LEDATA record is to be placed.
  36.  
  37. Enumerated Data Offset Field
  38. ----------------------------
  39.  
  40. The Enumerated Data Offset field is either a 2- or 4-byte field
  41. (depending on the record type) that determines the offset at which the
  42. first data byte is to be placed relative to the start of the SEGDEF
  43. segment. Successive data bytes occupy successively higher locations.
  44.  
  45. Data Bytes Field
  46. ----------------
  47.  
  48. The maximum number of data bytes is 1024, so that a FIXUPP Location
  49. field, which is 10 bits, can reference any of these data bytes. The
  50. number of data bytes is computed from the Record Length field minus 5,
  51. minus the size of the Segment Index field (1 or 2 bytes).
  52.   
  53.   NOTES
  54.   
  55.   Record type A1H has the offset stored as a 32-bit value. Record type
  56.   A0H encodes the offset value as a 16-bit numeric field (zero-
  57.   extended if applied to a Use32 segment).
  58.   
  59.   If an LEDATA record requires a fixup, a FIXUPP record must
  60.   immediately follow the LEDATA record.
  61.   
  62.   Code for functions is output in LEDATA records currently. The
  63.   segment for code is usually named _TEXT (or module_TEXT, depending
  64.   on the memory model), unless #pragma alloc_text is used to specify a
  65.   different code segment for the specified functions.
  66.   
  67.   For instantiated functions in C++, code will simply be output in
  68.   COMDAT records that refer to the function and identify the
  69.   function's segment.
  70.   
  71.   Data, usually generated by initialized variables (global or static),
  72.   is output in LEDATA/LIDATA records referring to either a data
  73.   segment or, possibly, a segment created for a based variable.
  74.  
  75. Examples
  76. --------
  77.  
  78. The following LEDATA record contains a simple text string:
  79.  
  80.       0  1  2  3  4  5  6  7  8  9  A  B  C  D  E  F   
  81.  0000 A0 13 00 02 00 00 48 65 6C 6C 6F 2C 20 77 6F 72......Hello, wor
  82.  0010 6C 64 0D 0A 24 A8                              ld..$.
  83.  
  84. Byte 00H contains 0A0H, which identifies this as an LEDATA record.
  85.  
  86. Bytes 01-02H contain 0013H, the length of the remainder of the record.
  87.  
  88. Byte 03H (the Segment Index field) contains 02H, a reference to the
  89. second SEGDEF record in the object module.
  90.  
  91. Bytes 04-05H (the Enumerated Data Offset field) contain 0000H. This is
  92. the offset, from the base of the segment indicated by the Segment
  93. Index field, at which the data in the Data Bytes field will be placed
  94. when the program is linked. Of course, this offset is subject to
  95. relocation by the linker because the segment declared in the specified
  96. SEGDEF record may be relocatable and may be combined with other
  97. segments declared in other object modules.
  98.  
  99. Bytes 06-14H (the Data Bytes field) contain the actual data.
  100.  
  101. Byte 15H contains the Checksum field, 0A8H.
  102.  
  103.  
  104. A2H OR A3H LIDATA--LOGICAL ITERATED DATA RECORD
  105. ===============================================
  106.  
  107. Description
  108. -----------
  109.  
  110. Like the LEDATA record, the LIDATA record contains binary data--
  111. executable code or program data. The data in an LIDATA record,
  112. however, is specified as a repeating pattern (iterated), rather than
  113. by explicit enumeration.
  114.  
  115. The data in an LIDATA record can be modified by the linker if the
  116. LIDATA record is followed by a FIXUPP record, although this is not
  117. recommended.
  118.  
  119. History
  120. -------
  121.  
  122. Record type A3H is new for LINK386; it has Iterated Data Offset and
  123. Repeat Count fields of 32 bits rather than 16 bits.
  124.  
  125. Record Format
  126. -------------
  127.  
  128.    1    2       1 or 2  2 or 4    <from Record Length>  1
  129.    A2   Record  Segment Iterated  Data                  Checksum
  130.    or   Length  Index   Data      Block                 
  131.    A3                   Offset                          
  132.                                   <-----------repeated----------->
  133.    
  134. Segment Index and Interated Data Offset Fields
  135. ----------------------------------------------
  136.  
  137. The Segment Index and Iterated Data Offset fields (2 or 4 bytes) are
  138. the same as for an LEDATA record. The index must be nonzero. This
  139. indicates the segment and offset at which the data in this LIDATA
  140. record is to be placed when the program is loaded.
  141.  
  142. Data Block Field
  143. ----------------
  144.  
  145. The data blocks have the following form:
  146.                        
  147.    2 or 4    2         <from Block Count>
  148.    Repeat    Block     Content
  149.    Count     Count     
  150.  
  151. Repeat Count Field
  152. ------------------
  153.  
  154. The Repeat Count field is a 16-bit or 32-bit value that determines the
  155. number of times the Content field is to be repeated. The Repeat Count
  156. field is 32 bits only if the record type is A3H.
  157.   
  158.   Conflict: The PharLap OMF uses a 16-bit Repeat Count field, even in
  159.   32-bit records.
  160.  
  161. Block Count Field
  162. -----------------
  163.  
  164. The Block Count field is a 16-bit word whose value determines the
  165. interpretation of the Content field, as follows:
  166.  
  167.    0      Indicates that the Content field that follows is a 1-byte
  168.           count value followed by count data bytes. The data bytes
  169.           will be mapped to memory, repeated as many times as are
  170.           specified in the Repeat Count field.
  171.           
  172.    != 0   Indicates that the Content field that follows is composed
  173.           of one or more Data Block fields. The value in the Block
  174.           Count field specifies the number of Data Block fields
  175.           (recursive definition).
  176.           
  177.   
  178.   NOTES
  179.   
  180.   The Microsoft C Compiler generates LIDATA records for initialized
  181.   data. For example:
  182.    
  183.       static int a[100] = { 1, };
  184.   
  185.   A FIXUPP record may occur after the LIDATA record; however, the
  186.   fixup is applied before the iterated data block is expanded. It is a
  187.   translator error for a fixup to reference any of the Count fields.
  188.  
  189. Example 1
  190. ---------
  191.    
  192.       02 00 02 00 03 00 00 00 02 40 41 02 00 00 00 02 50 51
  193.  
  194. is an iterated data block with 16-bit repeat counts that expands to:
  195.  
  196.       40 41 40 41 40 41 50 51 50 51 40 41 40 41 40 41 50 51 50 51
  197.  
  198. Here, the outer data block has a repeat count of 2 and a block count
  199. of 2 (which means to repeat twice the result of expanding the two
  200. inner data blocks). The first inner data block has repeat count = 3,
  201. block count = 0. The content is 2 bytes of data (40 41); the repeat
  202. count expands the data to a string of 6 bytes. The second (and last)
  203. inner data block has a repeat count = 2, block count = 0, content 2
  204. bytes of data (50 51). This expands to 4 bytes, which is concatenated
  205. with the 6 bytes from the first inner data block. The resulting 10
  206. bytes are then expanded by 2 (the repeat count of the outer data
  207. block) to form the 20-byte sequence illustrated.
  208.  
  209. Example 2
  210. ---------
  211.  
  212. This sample LIDATA record corresponds to the following assembler
  213. statement, which declares a 10-element array containing the strings
  214. ALPHA and BETA:
  215.    
  216.    db   10 dup('ALPHA','BETA')
  217.  
  218. The LIDATA record is
  219.    
  220.       0  1  2  3  4  5  6  7  8  9  A  B  C  D  E  F
  221. 0000  A2 1B 00 01 00 00 0A 00 02 00 01 00 00 00 05 41 ...............A
  222. 0010  4C 50 48 41 01 00 00 00 04 42 45 54 41 A9       LPHA.....BETA.
  223.  
  224. Byte 00H contains 0A2H, identifying this as an LIDATA record.
  225.  
  226. Bytes 01-02H contain 1BH, the length of the remainder of the record.
  227.  
  228. Byte 03H (the Segment Index field) contains 01H, a reference to the
  229. first SEGDEF record in this object module, indicating that the data
  230. declared in this LIDATA record is to be placed into the segment
  231. described by the first SEGDEF record.
  232.  
  233. Bytes 04-05H (the Iterated Data Offset field) contain 0000H, so the
  234. data in this LIDATA record is to be located at offset 0000H in the
  235. segment designated by the segment.
  236.  
  237. Bytes 06-1CH represent an iterated data block:
  238.  
  239.  - Bytes 06-07H contain the repeat count, 000AH, which indicates that
  240.    the Content field of this iterated data block is to be repeated 10
  241.    times.
  242.  
  243.  - Bytes 08-09H (the block count for this iterated data block) contain
  244.    0002H, which indicates that the Content field of this iterated data
  245.    block (bytes 0A-1CH) contains two nested iterated data block fields
  246.    (bytes 0A-13H and bytes 14-1CH).
  247.  
  248.  - Bytes 0A-0BH contain 0001H, the repeat count for the first nested
  249.    iterated data block. Bytes 0C-0DH contain 0000H, indicating that
  250.    the Content field of this nested iterated data block contains data
  251.    rather than more nested iterated data blocks. The Content field
  252.    (bytes 0E-13H) contains the data; byte 0EH contains 05H, the number
  253.    of subsequent data bytes; and bytes 0F-13H contain the actual data
  254.    (the string ALPHA).
  255.  
  256.  - Bytes 14-1CH represent the second nested iterated data block, which
  257.    has a format similar to that of the block in bytes 0A-13H. This
  258.    second nested iterated data block represents the 4-byte string
  259.    BETA.
  260.  
  261.  - Byte 1DH is the Checksum field, 0A9H.
  262.  
  263.  
  264. B0H COMDEF--COMMUNAL NAMES DEFINITION RECORD
  265. ============================================
  266.  
  267. Description
  268. -----------
  269.  
  270. The COMDEF record is a Microsoft extension to the basic set of 8086
  271. object record types. It declares a list of one or more communal
  272. variables (uninitialized static data, or data that may match
  273. initialized static data in another compilation unit).
  274.  
  275. The size of such a variable is the maximum size defined in any module
  276. naming the variable as communal or public. The placement of communal
  277. variables is determined by the data type using established conventions
  278. (noted below).
  279.  
  280. History
  281. -------
  282.  
  283. The COMDEF record is recognized by versions 3.5 and later of LINK.
  284.  
  285. Record Format
  286. -------------
  287.  
  288.   1  2      1      <String Length> 1 or 2 1    1 or 2 1 <from Data Type>    
  289.   B0 Record String Communal        Type   Data Communal Checksum
  290.      Length Length Name            Index  Type Length          
  291.             <----------------repeated------------------>
  292.              
  293. Communal Name Field
  294. -------------------
  295.  
  296. The name is in <count, char> string format, and the name may be null.
  297. NEAR and FAR communals from different object files are matched at bind
  298. or link time if their names agree; the variable's size is the maximum
  299. of the sizes specified (subject to some constraints, as documented
  300. below).
  301.  
  302. Type Index Field
  303. ----------------
  304.  
  305. This field encodes symbol information; it is parsed as an index field
  306. (1 or 2 bytes) and is not inspected by current linkers. This field is
  307. now used by CodeView instead of for its original purpose.
  308.  
  309. Data Type and Communal Length Fields
  310.  
  311. The Data Type field indicates the contents of the Communal Length
  312. field. All Data Type values for NEAR data indicate that the Communal
  313. Length field has only one numeric value: the amount of memory to be
  314. allocated for the communal variable. All Data Type values for FAR data
  315. indicate that the Communal Length field has two numeric values: the
  316. first is the number of elements, and the second is the element size.
  317.  
  318. The Data Type field is one of the following hexadecimal values:
  319.  
  320.    61H   FAR data; the length is specified as the number of the
  321.          elements followed by the element size in bytes
  322.          
  323.    62H   NEAR data; the length is specified as the number of bytes
  324.  
  325. The Communal Length field is a single numeric field or a pair of
  326. numeric fields (as specified by the Data Type field), encoded as
  327. follows:
  328.  
  329.                    Number    
  330.    Value Range     of Bytes   Allocation
  331.    ----------------------------------------------------------------
  332.    0 through 128       1      This byte contains the value
  333.   
  334.    0 to 64K-1          3      First byte is 81H, followed by a 16-bit
  335.                               word whose value is used
  336.  
  337.    0 to 16 MB-1        4      First byte is 84H, followed by a 3-byte
  338.                               value
  339.  
  340.    -2 GB-1 to 2 GB-1   5      First byte is 88H, followed by a 4-byte
  341.                               value
  342.  
  343. Groups of Communal Name, Type Index, Data Type, and Communal Length
  344. fields can be repeated so that more than one communal variable can be
  345. declared in the same COMDEF record.
  346.   
  347.   NOTES
  348.   
  349.   If a public or exported symbol with the same name is found in
  350.   another module to which this module is bound or linked, LINK gives
  351.   the error "symbol defined more than once."
  352.   
  353.   Communal variables cannot be resolved to dynamic links (that is,
  354.   imported symbols).
  355.   
  356.   The records are ordered by occurrence, together with the items named
  357.   in EXTDEF and LEXTDEF records (for reference in FIXUP subrecords).
  358.   
  359.   In older versions of the linker, any object module that contains
  360.   COMDEF records is required to also contain one COMENT record with
  361.   the comment class 0A1H, indicating that Microsoft extensions to the
  362.   Intel object record specification are included in the object module.
  363.   This COMENT record is no longer required; current versions of the
  364.   linker always interpret COMDEF records.
  365.  
  366. Examples
  367. --------
  368.  
  369. The following COMDEF record was generated by Microsoft C Compiler
  370. version 4.0 for these public variable declarations:
  371.  
  372.    int   var;                   /* 2-byte integer */
  373.    char  var2[32768];           /* 32768-byte array */
  374.    char  far var3[10][2][20];   /* 400-byte array */
  375.  
  376. The COMDEF record is:
  377.  
  378.          0  1  2  3  4  5  6  7  8  9  A  B  C  D  E  F
  379. 0000 B0 20 00 04 5F 66 6F 6F 00 62 02 05 5F 66 6F 6F  . .._var.b.._var
  380. 0010 32 00 62 81 00 80 05 5F 66 6F 6F 33 00 61 81 90  2.b...._var3.a..
  381. 0020 01 01 99                                         ...
  382.  
  383. Byte 00H contains 0B0H, indicating that this is a COMDEF record.
  384.  
  385. Bytes 01-02H contain 0020H, the length of the remainder of the record.
  386.  
  387. Bytes 03-0AH, 0B-15H, and 16-21H represent three declarations for the
  388. communal variables var, var2, and var3. The C compiler prepends an
  389. underscore to each of the names declared in the source code, so the
  390. symbols represented in this COMDEF record are _var, _var2, and _var3.
  391.  
  392. Byte 03H contains 04H, the length of the first Communal Name field in
  393. this record. Bytes 04-07H contain the name itself (_var). Byte 08H
  394. (the Type Index field) contains 00H, as required. Byte 09H (the Data
  395. Type field) contains 62H, indicating that this is a NEAR variable.
  396. Byte 0AH (the Communal Length field) contains 02H, the size of the
  397. variable in bytes.
  398.  
  399. Byte 0BH contains 05H, the length of the second Communal Name field.
  400. Bytes 0C-10H contain the name _var2. Byte 11H is the Type Index field,
  401. which again contains 00H, as required. Byte 12H (the Data Type field)
  402. contains 62H, indicating that _var2 is a NEAR variable.
  403.  
  404. Bytes 13-15H (the Communal Length field) contain the size in bytes of
  405. the variable. The first byte of the Communal Length field (byte 13H)
  406. is 81H, indicating that the size is represented in the subsequent two
  407. bytes of data--bytes 14-15H, which contain the value 8000H.
  408.  
  409. Bytes 16-1BH represent the Communal Name field for _var3, the third
  410. communal variable declared in this record. Byte 1CH (the Type Index
  411. field) again contains 00H as required. Byte 1DH (the Data Type field)
  412. contains 61H, indicating that this is a FAR variable. This means the
  413. Communal Length field is formatted as a Number of Elements field
  414. (bytes 1E-20H, which contain the value 0190H) and an Element Size
  415. field (byte 21H, which contains 01H). The total size of this communal
  416. variable is thus 190H times 1, or 400 bytes.
  417.  
  418. Byte 22H contains the Checksum field, 99H.
  419.  
  420.  
  421. B2H OR B3H BAKPAT--BACKPATCH RECORD
  422. ===================================
  423.  
  424. Description
  425. -----------
  426.  
  427. This record is for backpatches to LOCATIONs that cannot be
  428. conveniently handled by a FIXUPP record at reference time (for
  429. example, forward references in a one-pass compiler). It is essentially
  430. a specialized fixup.
  431.  
  432. History
  433. -------
  434.  
  435. Record type B2H is a Microsoft extension that was added for QuickC
  436. version 1.0. Record type B3H is the 32-bit equivalent: the Offset and
  437. Value fields are 32 bits rather than 16 bits.
  438.  
  439. Record Format
  440. -------------
  441.  
  442.   1     2       1 or 2   1         2 or 4     2 or 4    1
  443.   B2    Record  Segment  Location  Offset     Value     Checksum
  444.   or B3 Length  Index    Type                         
  445.   
  446.                                    <-----repeated----->
  447.                             
  448. Segment Index Field
  449. -------------------
  450.  
  451. Segment index to which all "backpatch" FIXUPP records are to be
  452. applied. Note that, in contrast to FIXUPP records, these records do
  453. not need to follow the data record to be fixed up. Hence, the segment
  454. to which the backpatch applies must be specified explicitly.
  455.  
  456. Location Type Field
  457. -------------------
  458.  
  459. Type of LOCATION to be patched; the only valid values are:
  460.    
  461.    0    8-bit low-order byte
  462.    1    16-bit offset
  463.    2    32-bit offset, record type B3H only (not supported yet)
  464.  
  465. Offset and Value Fields
  466. -----------------------
  467.  
  468. These fields are 32 bits for record type B3H, and 16 bits for B2H.
  469.  
  470. The Offset field specifies the LOCATION to be patched (as an offset
  471. into the SEGDEF record whose index is Segment Index).
  472.  
  473. The associated Value field is added to the LOCATION being patched
  474. (unsigned addition, ignoring overflow). The Value field is a fixed
  475. length (16 bits or 32 bits, depending on the record type) to make
  476. object-module processing easier.
  477.   
  478.   NOTE: BAKPAT records can occur anywhere in the object module
  479.   following the SEGDEF record to which they refer. They do not have to
  480.   immediately follow the appropriate LEDATA record as FIXUPP records
  481.   do.
  482.   
  483.   These records are buffered by the linker in Pass 2 until the end of
  484.   the module, after the linker applies all other FIXUPP records. LINK
  485.   then processes these records as fixups.
  486.  
  487. Examples
  488. --------
  489.  
  490. For example, to generate a self-relative address whose TARGET is a
  491. forward reference (JZ forwardlabel), the translator can insert the
  492. negative offset of the next instruction (-*) from the start of the
  493. SEGDEF record, followed by an additive backpatch (meaning that the
  494. backpatch is added to the original value and the sum replaces the
  495. original value) whose Value is the offset of the TARGET of the jump,
  496. which is done last.
  497.  
  498.  
  499. B4H OR B5H LEXTDEF--LOCAL EXTERNAL NAMES DEFINITION RECORD
  500. ==========================================================
  501.  
  502. Description
  503. -----------
  504.  
  505. This record is identical in form to the EXTDEF record described
  506. earlier. However, the symbols named in this record are not visible
  507. outside the module in which they are defined.
  508.  
  509. History
  510. -------
  511.  
  512. This record was a Microsoft extension for C 5.0. There is no semantic
  513. difference between the B4H and B5H types.
  514.  
  515. Record Format
  516. -------------
  517.  
  518.    1    2        1       <String Length>  1 or 2  1
  519.    B4   Record   String  External         Type    Checksum
  520.    B5   Length   Length  Name String      Index   
  521.                  <--------------repeated------->
  522.   
  523.   NOTE: These records are associated with LPUBDEF and LCOMDEF records
  524.   and ordered with the EXTDEF records by occurrence, so that they may
  525.   be referenced by an external name index for fixups.
  526.   
  527.   The name string, when stored in LINK's internal data structures, is
  528.   encoded with spaces and digits at the beginning of the name.
  529.  
  530. Examples
  531. --------
  532.  
  533. This record type is produced in C from static functions, such as:
  534.    
  535.    static int var() { }
  536.  
  537.  
  538. B6H OR B7H LPUBDEF--LOCAL PUBLIC NAMES DEFINITION RECORD
  539. ========================================================
  540.  
  541. Description
  542. -----------
  543.  
  544. This record is identical in form to the PUBDEF record described
  545. earlier. However, the symbols named in this record are not visible
  546. outside the module in which they are defined.
  547.  
  548. History
  549. -------
  550.  
  551. This record was a Microsoft extension for C 5.0. Record type B7H is
  552. new for LINK386: the Local Offset field is 32 bits rather than 16
  553. bits.
  554.  
  555. Record Format
  556. -------------
  557.    1  2       1 or 2 1 or 2 2      1      <String  2 or 4 1 or 2 1
  558.                                            Length>  
  559.    B6 Record  Base   Base    Base   String Local   Local   Type  Checksum
  560.    or Length  Group  Segment Frame  Length Name    Offset  Index  
  561.    B7                                      String 
  562.                              <cond.><----------repeated---------->  
  563.   
  564. Examples
  565. --------
  566.  
  567. In C, the static keyword on functions or initialized variables
  568. produces LPUBDEF records. Uninitialized static variables produce
  569. LCOMDEF records.
  570.  
  571.  
  572. B8H LCOMDEF--LOCAL COMMUNAL NAMES DEFINITION RECORD
  573. ===================================================
  574.  
  575. Description
  576. -----------
  577.  
  578. This record is identical in form to the COMDEF record described
  579. previously. However, the symbols named in this record are not visible
  580. outside the module in which they are defined.
  581.  
  582. History
  583. -------
  584.  
  585. This record was a Microsoft extension for C 5.0.
  586.  
  587. Record Format
  588. -------------
  589.  
  590.    1  2       1       <String      1      1      <from      1
  591.                       Length>      or 2          Data Type>
  592.    B8 Record  String  Communal     Type   Data   Communal   Checksum
  593.       Length  Length  Name         Index  Type   Length          
  594.               <--------------repeated---------------------->  
  595.  
  596. Examples
  597. --------
  598.  
  599. In C, uninitialized static variables produce an LCOMDEF record.
  600.  
  601.  
  602. BCH CEXTDEF--COMDAT EXTERNAL NAMES DEFINITION RECORD
  603. ====================================================
  604.  
  605. Description
  606. -----------
  607.  
  608. This record serves the same purpose as the EXTDEF record described
  609. earlier. However, the symbol named is referred to through a Logical
  610. Name Index field. Such a Logical Name Index field is defined through
  611. an LNAMES or LLNAMES record.
  612.  
  613. History
  614. -------
  615.  
  616. The record is a Microsoft extension for C 7.0.
  617.  
  618. Record Format
  619. -------------
  620.  
  621.                                             
  622.    1    2      1 or 2          1 or 2       1
  623.    BC   Record Logical Name    Type         Checksum
  624.         Length Index           Index        
  625.                <---------repeated-------->  
  626.                
  627.                
  628.   NOTE: A CEXTDEF can precede the COMDAT to which it will be resolved.
  629.   In this case, the location of the COMDAT is not known at the time
  630.   the CEXTDEF is seen.
  631.  
  632. Examples
  633. --------
  634.  
  635. This record is produced when a FIXUPP record refers to a COMDAT
  636. symbol.
  637.  
  638.  
  639. C2H OR C3H COMDAT--INITIALIZED COMMUNAL DATA RECORD
  640. ===================================================
  641.  
  642. Description
  643. -----------
  644.  
  645. The purpose of the COMDAT record is to combine logical blocks of code
  646. and data that may be duplicated across a number of compiled modules.
  647.  
  648. History
  649. -------
  650.  
  651. The record is a Microsoft extension for C 7.0.
  652.  
  653. Record Format
  654. -------------
  655.  1  2      1      1      1      2 or 4 1 or  2      1 or 2 1    1     
  656.  C2 Record Flags  Attrib Align  Enumer Type  Public Public Data Check
  657.  or Length        -utes         -ated  Index Base   Name        Sum  
  658.  C3                             Data                Index     
  659.                                 Offset                       
  660.  
  661.                                                     <repeated> 
  662.                                                      
  663. Flags Field
  664. -----------
  665.  
  666. This field contains the following defined bits:
  667.  
  668.    01H   Continuation bit. If clear, this COMDAT record establishes
  669.          a new instance of the COMDAT variable; otherwise, the data
  670.          is a continuation of the previous COMDAT of the symbol.
  671.          
  672.    02H   Iterated data bit. If clear, the Data field contains
  673.          enumerated data; otherwise, the Data field contains
  674.          iterated data, as in an LIDATA record.
  675.          
  676.    04H   Local bit (effectively an "LCOMDAT"). This is used in
  677.          preference to LLNAMES.
  678.          
  679.    08H   Data in code segment. If the application is overlayed, this
  680.          COMDAT must be forced into the root text. Also, do not
  681.          apply FARCALLTRANSLATION to this COMDAT.
  682.  
  683. Attributes Field
  684. ----------------
  685.           
  686. This field contains two 4-bit fields: the Selection Criteria to be
  687. used, and the Allocation Type, an ordinal specifying the type of
  688. allocation to be performed. Values are:
  689.  
  690.    Selection Criteria (High-Order 4 Bits):
  691.  
  692.    Bit       Selection Criteria
  693.                        
  694.    00H       No match  Only one instance of this COMDAT allowed.
  695.                        
  696.    10H       Pick Any  Pick any instance of this COMDAT.
  697.                        
  698.    20H       Same      Pick any instance, but instances must have
  699.              Size      the same length or the linker will generate
  700.                        an error.
  701.                        
  702.    30H       Exact     Pick any instance, but checksums of the
  703.              Match     instances must match or the linker will
  704.                        generate an error. Fixups are ignored.
  705.                        
  706.    40H -               Reserved.
  707.    F0H
  708.  
  709.    Allocation Type (Low-Order 4 bits):
  710.    
  711.    Bit       Allocation 
  712.                                   
  713.    00H       Explicit Allocate in the segment specified in the
  714.                       ensuing Base Group, Base Segment, and Base
  715.                       Frame fields.
  716.                                           
  717.    01H       Far      Allocate as CODE16. The linker will create
  718.              Code     segments to contain all COMDATs of this type.
  719.                       
  720.    02H       Far      Allocate as DATA16. The linker will create
  721.              Data     segments to contain all COMDATs of this type.
  722.                       
  723.    03H       Code32   Allocate as CODE32. The linker will create
  724.                       segments to contain all COMDATs of this type.
  725.                       
  726.    04H       Data32   Allocate as DATA32. The linker will create
  727.                       segments to contain all COMDATs of this type.
  728.                       
  729.    05H -              Reserved.
  730.    0FH
  731.  
  732. Align Field
  733.  
  734. These codes are based on the ones used by the SEGDEF record:
  735.    
  736.    0   Use value from SEGDEF
  737.    1   Byte aligned
  738.    2   Word aligned
  739.    3   Paragraph (16 byte) aligned
  740.    4   256-byte aligned
  741.    5   Double word (4 byte) aligned
  742.    6   Not defined
  743.    7   Not defined
  744.  
  745. Enumerated Data Offset Field
  746. ----------------------------
  747.           
  748. This field specifies an offset relative to the beginning location of
  749. the symbol specified in the Public Name Index field and defines the
  750. relative location of the first byte of the Data field. Successive data
  751. bytes in the Data field occupy higher locations of memory. This works
  752. very much like the Enumerated Data Offset field in an LEDATA record,
  753. but instead of an offset relative to a segment, this is relative to
  754. the beginning of the COMDAT symbol.
  755.  
  756. Type Index Field
  757. ----------------
  758.  
  759. The Type Index field is encoded in index format; it contains either
  760. proprietary CodeView-type information or an old-style TYPDEF index. If
  761. this index is 0, there is no associated type data. Old-style TYPDEF
  762. indexes are ignored by LINK. Current linkers do not perform type
  763. checking.
  764.  
  765. Public Base Field
  766. -----------------
  767.  
  768. This field is conditional and is identical to the public base fields
  769. (Base Group, Base Segment, and Base Frame) stored in the PUBDEF
  770. record. This field is present only if the Allocation Type field
  771. specifies Explicit allocation.
  772.  
  773. Public Name Index Field
  774. -----------------------
  775.  
  776. This field is a regular logical name index (1 or 2 bytes).
  777.  
  778. Data Field
  779. ----------
  780.  
  781. The Data field provides up to 1024 consecutive bytes of data. If there
  782. are fixups, they must be emitted in a FIXUPP record that follows the
  783. COMDAT record. The data can be either enumerated or iterated,
  784. depending on the Flags field.
  785.  
  786.   NOTES
  787.   
  788.   Record type C3H has an Enumerated Data Offset field of 32 bits.
  789.   
  790.   While creating addressing frames, the linker will add the COMDAT
  791.   data to the appropriate logical segments, adjusting their sizes. At
  792.   that time, the offset at which the data will go inside the logical
  793.   segment will be calculated. Next, the linker will create physical
  794.   segments from adjusted logical segments, reporting any 64K boundary
  795.   overflows.
  796.   
  797.   If the allocation type is not explicit, COMDAT code and data is
  798.   accumulated by the linker and broken up into segments, so that the
  799.   total can exceed 64K.
  800.   
  801.   In Pass 2, only the selected occurrence of COMDAT data will be
  802.   stored in virtual memory, fixed up, and later written into the .EXE
  803.   file.
  804.   
  805.   COMDATs are allocated in the order of their appearance in the .OBJ
  806.   files if no explicit ordering is given.
  807.   
  808.   A COMDAT record cannot be continued across modules. A COMDAT record
  809.   can be duplicated in a single module.
  810.   
  811.   If any COMDAT record on a given symbol has the local bit set, all
  812.   the COMDAT records on that symbol have that bit set.
  813.